<?php

namespace app\admin\model;

use think\Model;


class Cost extends Model
{





    // 表名
    protected $name = 'cost';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];


    public function typeList()
    {
        return ['1' => __('固定计费'),'2' => __('自定义')];
    }
    public function Productname()
    {
        //return $this->belongsTo('Product', 'id', 'product_id')->setEagerlyType(0);
        return $this->belongsTo('Productname', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    public function Product()
    {
        //return $this->belongsTo('Product', 'id', 'product_id')->setEagerlyType(0);
        return $this->belongsTo('Product', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    public function Factory()
    {
        return $this->belongsTo('Factory', 'factory_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
    public function Costmode()
    {
        return $this->belongsTo('Costmode', 'costmode_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }





}
